FROM ubuntu:14.04
MAINTAINER Brick Yang <brick.yang@printfxxx.com>

ARG DEBIAN_FRONTEND=noninteractive
ARG APT_MIRROR_URL=archive.ubuntu.com

RUN cp /etc/apt/sources.list /etc/apt/sources.list.orig
RUN sed -i -e "s/archive.ubuntu.com/$APT_MIRROR_URL/g" /etc/apt/sources.list

RUN rm -rf /var/lib/apt/lists/*
RUN apt-get autoclean && apt-get autoremove && apt-get update --fix-missing && apt-get upgrade --fix-missing -y \
	&& apt-get dist-upgrade --fix-missing -y && apt-get install -y apt-utils sudo locales
RUN echo 'dash dash/sh boolean false' | debconf-set-selections && dpkg-reconfigure dash
RUN locale-gen --lang en_US.UTF-8 && echo 'LANG=en_US.UTF-8' > /etc/default/locale
RUN passwd -d root

RUN apt-get install -y openssh-server vim
RUN apt-get install -y gawk wget git-core diffstat unzip texinfo gcc g++	\
	build-essential chrpath socat libsdl1.2-dev xterm xz-utils tofrodos	\
	libstring-crc32-perl screen bc sed subversion coreutils texi2html cvs	\
	docbook-utils fop python-pysqlite2 make xsltproc desktop-file-utils	\
	libgl1-mesa-dev	libglu1-mesa-dev autoconf automake groff libtool	\
	libxml-parser-perl ubuntu-minimal ubuntu-standard patch			\
	libbonobo2-common libncurses5-dev
	
RUN if [ "`uname -m`" = "x86_64" ]; then \
	apt-get install -y lib32ncurses5-dev lib32z1 \
	lib32ncurses5 lib32bz2-1.0; fi
RUN echo 'UseDNS no' >> /etc/ssh/sshd_config

ADD startup.sh /usr/local/bin/startup.sh
RUN chmod a+x /usr/local/bin/startup.sh
ADD init.sh /usr/local/bin/init.sh
RUN chmod a+x /usr/local/bin/init.sh

ENTRYPOINT ["/usr/local/bin/startup.sh"]

EXPOSE 22
